<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">	
		<title>微信安全支付</title>
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
		<meta name="msapplication-tap-highlight" content="no">
		<meta name="robots" content="noarchive">
		<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
		<meta name="renderer" content="webkit">
		<script src="__PUBLIC__/js/jquery-1.7.min.js"></script>
		<style>
		.icon{ text-align:center; padding-top:50px;}
		.icon img{ width:50%;}
		.total{ font-size:14px; text-align:center; padding:20px;}
		.btn input{ width:100%; height:40px; background:rgb(18, 163, 18); color:#fff; border:none;}
		.success{ display:none;}
		</style>
	</head>
	<body class="result">
		<div class="icon wxpay">
			<img src="__PUBLIC__/images/wxpay.png" />
		</div>
		<div class="total wxpay">
			<small>总费用</small> ￥ {$money} <small>元</small>
		</div>
		<div class="btn wxpay">
			<input type="button" value="微信安全支付" id="paybtn" onclick="callpay()" />
		</div>
		
		
		<div class="icon success">
			<img src="__PUBLIC__/images/ok.png" />
		</div>
		<div class="text success">
			您已支付成功，客服将尽快和您联系！
		</div>
	</body>
	<script>
		//调用微信JS api 支付
		function jsApiCall()
		{
			WeixinJSBridge.invoke(
				"getBrandWCPayRequest",
				{$jsApiParameters},
				function(res){
					if(res.err_msg=='get_brand_wcpay_request:ok'){
						$(".wxpay").hide();
						$(".success").show();
					}else{
						
						if('get_brand_wcpay_request:cancel' == res.err_msg)
							$("#paybtn").val('重新支付');
						else alert(res.err_msg);
					}
				}
			);
		}

		function callpay()
		{
			if (typeof WeixinJSBridge == "undefined"){
			    if( document.addEventListener ){
			        document.addEventListener("WeixinJSBridgeReady", jsApiCall, false);
			    }else if (document.attachEvent){
			        document.attachEvent("WeixinJSBridgeReady", jsApiCall); 
			        document.attachEvent("onWeixinJSBridgeReady", jsApiCall);
			    }
			}else{
			    jsApiCall();
			}
		}
	</script>
</html>